<template>
  <el-container style="height: 850px">
    <el-header style="height: 10%; background-color: rgb(72, 209, 204)">
      <div
        style="
          background-color: rgb(72, 209, 204);
          width: 33%;
          height: 100%;
          float: left;
        "
      ></div>
      <div
        style="
          background-color: rgb(72, 209, 204);
          width: 34%;
          height: 100%;
          float: left;
        "
      >
        <p
          style="
            color: #91959c;
            font-size: 23px;
            line-height: 23px;
            font-weight: bold;
            height: 40px;
          "
        >
          后台管理
        </p>
      </div>
      <div
        style="
          background-color: rgb(72, 209, 204);
          width: 33%;
          height: 100%;
          float: left;
        "
      >
        <el-button type="danger" plain @click="jump('Index')"
          >返回主页</el-button
        >
      </div>
    </el-header>
    <el-container style="height: 70%">
      <el-aside width="300px">
        <el-menu
          default-active="1-4-1"
          class="el-menu-vertical-demo"
          background-color="#fff"
          @open="handleOpen"
          @close="handleClose"
          style="background-color: white; width: 299px; height: 100%"
        >
          <el-submenu index="1" style="background-color: black">
            <template slot="title">
              <i
                style="
                  font-size: 23px;
                  color: slategray;
                  font-style: normal;
                  font-weight: bold;
                "
                >个人信息管理</i
              >
            </template>
            <el-menu-item-group class="hh">
              <el-menu-item index="1-1" @click="jump('Info')"
                ><p
                  style="
                    font-size: 15px;
                    color: slategray;
                    line-height: 0px;
                    margin: 0px;
                  "
                >
                  信息查看
                </p></el-menu-item
              >
              <el-menu-item index="1-2" @click="jump('UpInfo')"
                ><p
                  style="
                    font-size: 15px;
                    color: slategray;
                    line-height: 0px;
                    margin: 0px;
                  "
                >
                  信息修改
                </p></el-menu-item
              >
            </el-menu-item-group>
          </el-submenu>
          <el-submenu index="2" v-if="this.role1">
            <template slot="title">
              <i
                style="
                  font-size: 23px;
                  color: slategray;
                  font-style: normal;
                  font-weight: bold;
                "
                >公司管理</i
              >
            </template>
            <el-menu-item-group class="hh" style="font-size: 23px">
              <el-menu-item index="2-1" style="margin: 0px"
                ><p
                  style="
                    font-size: 15px;
                    color: slategray;
                    line-height: 0px;
                    margin: 0px;
                  "
                >
                  查看公司信息
                </p></el-menu-item
              >
              <el-menu-item index="2-4-1" @click="jump('ProjectManage')"
                ><p
                  style="
                    font-size: 15px;
                    color: slategray;
                    line-height: 0px;
                    margin: 0px;
                  "
                >
                  查看申请中的项目
                </p></el-menu-item
              >
              <el-menu-item index="2-4-2" @click="jump('ProjectManageing')"
                ><p
                  style="
                    font-size: 15px;
                    color: slategray;
                    line-height: 0px;
                    margin: 0px;
                  "
                >
                  查看进行中的项目
                </p></el-menu-item
              >
              <el-menu-item index="2-4-3" @click="jump('ProjectManageFinsh')"
                ><p
                  style="
                    font-size: 15px;
                    color: slategray;
                    line-height: 0px;
                    margin: 0px;
                  "
                >
                  查看工作室完成的项目
                </p></el-menu-item
              >
              <el-menu-item index="2-4-3" @click="jump('Advertisement')"
                ><p
                  style="
                    font-size: 15px;
                    color: slategray;
                    line-height: 0px;
                    margin: 0px;
                  "
                >
                  广告位申请
                </p></el-menu-item
              >
              <!--<el-submenu index="2-4">-->
              <!--<span slot="title">项目管理</span>-->
              <!---->
              <!--</el-submenu>-->
            </el-menu-item-group>
          </el-submenu>

          <el-submenu index="3" v-if="this.role">
            <template slot="title">
              <i
                style="
                  font-size: 23px;
                  color: slategray;
                  font-style: normal;
                  font-weight: bold;
                "
                >工作室管理</i
              >
            </template>
            <el-menu-item-group>
              <el-menu-item index="3-1" @click="jump('AppendMember')"
                ><p
                  style="
                    font-size: 15px;
                    color: slategray;
                    line-height: 0px;
                    margin: 0px;
                  "
                >
                  成员录入
                </p></el-menu-item
              >
              <el-menu-item index="3-2" @click="jump('AppendFinshWork')"
                ><p
                  style="
                    font-size: 15px;
                    color: slategray;
                    line-height: 0px;
                    margin: 0px;
                  "
                >
                  作品录入
                </p></el-menu-item
              >
              <el-menu-item index="3-3" @click="jumpp('Workroom')"
                ><p
                  style="
                    font-size: 15px;
                    color: slategray;
                    line-height: 0px;
                    margin: 0px;
                  "
                >
                  工作室信息
                </p></el-menu-item
              >
              <el-menu-item index="3-4-1" @click="jump('ProjectInvate')"
                ><p
                  style="
                    font-size: 15px;
                    color: slategray;
                    line-height: 0px;
                    margin: 0px;
                  "
                >
                  查看项目邀请
                </p></el-menu-item
              >
              <el-menu-item index="3-4-2" @click="jumpp('ApplyingProject')"
                ><p
                  style="
                    font-size: 15px;
                    color: slategray;
                    line-height: 0px;
                    margin: 0px;
                  "
                >
                  申请中的项目
                </p></el-menu-item
              >
              <el-menu-item index="3-4-4" @click="jumpp('Projecting')"
                ><p
                  style="
                    font-size: 15px;
                    color: slategray;
                    line-height: 0px;
                    margin: 0px;
                  "
                >
                  进行中的项目
                </p></el-menu-item
              >
              <el-menu-item index="3-4-5" @click="jumpp('Projected')"
                ><p
                  style="
                    font-size: 15px;
                    color: slategray;
                    line-height: 0px;
                    margin: 0px;
                  "
                >
                  完成的项目
                </p></el-menu-item
              >
              <el-menu-item index="3-4-5" @click="jumpp('Advertisement')"
                ><p
                  style="
                    font-size: 15px;
                    color: slategray;
                    line-height: 0px;
                    margin: 0px;
                  "
                >
                  广告位申请
                </p></el-menu-item
              >
            </el-menu-item-group>
          </el-submenu>
          <el-submenu index="4" v-if="this.role">
            <template slot="title">
              <i
                style="
                  font-size: 23px;
                  color: slategray;
                  font-style: normal;
                  font-weight: bold;
                "
                >人员外包管理</i
              >
            </template>
            <el-menu-item-group>
              <el-menu-item index="4-1" @click="jump('Group')"
                ><p
                  style="
                    font-size: 15px;
                    color: slategray;
                    line-height: 0px;
                    margin: 0px;
                  "
                >
                  小组管理
                </p></el-menu-item
              >
            </el-menu-item-group>
          </el-submenu>

          <el-submenu index="5" v-if="this.role">
            <template slot="title">
              <i
                style="
                  font-size: 23px;
                  color: slategray;
                  font-style: normal;
                  font-weight: bold;
                "
                >众包管理</i
              >
            </template>
            <el-menu-item-group>
              <el-menu-item index="5-1" @click="jump('Team')"
                ><p
                  style="
                    font-size: 15px;
                    color: slategray;
                    line-height: 0px;
                    margin: 0px;
                  "
                >
                  队伍管理
                </p></el-menu-item
              >
              <el-menu-item index="5-1" @click="jump('MyTeam')"
                ><p
                  style="
                    font-size: 15px;
                    color: slategray;
                    line-height: 0px;
                    margin: 0px;
                  "
                >
                  项目管理
                </p></el-menu-item
              >
            </el-menu-item-group>
          </el-submenu>
        </el-menu>
      </el-aside>
      <el-main style="padding: 0px; height: 840px">
        <router-view></router-view>
      </el-main>
    </el-container>
  </el-container>
</template>
<style >
.el-menu-vertical-demo:not(.el-menu--collapse) {
  width: 200px;
  min-height: 400px;
}

.el-header,
.el-footer {
  color: #7c235b;
  text-align: center;
  line-height: 60px;
}

.el-aside {
  background-color: #c0c3bf;
  color: #333;
  line-height: 200px;
  font-size: 25px;
  font-weight: bold;
  text-align: left;
}

.el-main {
  background-color: #e0e4eb;
  color: #333;
  text-align: center;
  line-height: 60px;
}

body > .el-container {
  margin-bottom: 40px;
}
. hh {
  height: 56px;
  line-height: 56px;
  position: relative;
  -webkit-box-sizing: border-box;
  white-space: nowrap;
}
.el-container:nth-child(5) .el-aside,
.el-container:nth-child(6) .el-aside {
  line-height: 260px;
}
.el-menu-item,
.el-submenu__title {
  height: 56px;
  line-height: 56px;
  position: relative;
  -webkit-box-sizing: border-box;
  white-space: nowrap;
  padding-left: 100px;
  /*list-style-position: initial;*/
  list-style-type: initial;
}
.el-container:nth-child(7) .el-aside {
  line-height: 320px;
}
</style>
<script>
export default {
  data() {
    return {
      id: "",
      wid: "",
      role: "",
      role1: "",
    };
  },
  mounted: function () {
    var user = JSON.parse(window.sessionStorage.getItem("user"));
    this.id = user.id;
    if (user.role == "workroom") {
      this.role = true;
      this.role1 = false;
    } else if (user.role == "company") {
      this.role = false;
      this.role1 = true;
    } else {
      this.role = false;
      this.role1 = false;
    }

    if (user.role == "workroom") {
      axios
        .post("/workroom/findWorkroomByUid", {
          id: this.id,
          idd: this.id,
        })
        .then((response) => {
          if (response.data != null) {
            this.$notify({
              title: "成功",
              message: "成功",
              type: "success",
              duration: 2000,
            });
            console.log(response.data);
            this.wid = response.data;
          } else {
            this.$notify({
              title: "失败",
              message: "错误",
              type: "warning",
              duration: 2000,
            });
          }
        });
    }
  },
  methods: {
    jump(path) {
      this.$router.replace({ path: path });
    },
    deinfo() {
      axios
        .post("/factory/deInfo", {
          id: this.id,
          hh: this.id,
        })
        .then((response) => {
          console.log(response.data);
          if (response.data != 800) {
            this.$notify({
              title: "成功",
              message: "成功",
              type: "success",
              duration: 2000,
            });
            //  window.sessionStorage.setItem("user", JSON.stringify(response.data.user));
            // var token= window.sessionStorage.getItem("token");
            //var user= JSON.parse(window.sessionStorage.getItem("user"));
            this.$router.replace({ path: "DeInfo" });
          } else {
            this.$notify({
              title: "失败",
              message: "错误",
              type: "warning",
              duration: 2000,
            });
          }
        });
    },
    jumpp(path) {
      this.$router.push({
        path: path,
        query: {
          mallCode: this.wid,
        },
      });
    },

    handleOpen(key, keyPath) {
      console.log(key, keyPath);
    },
    handleClose(key, keyPath) {
      console.log(key, keyPath);
    },
  },
};
</script>
